String clazzTpl({package}) => """
import 'package:$package/store/app_config/app_config_state.dart';
import 'package:flutter/material.dart';

mixin ThemeBindingObserver<T extends StatefulWidget>
    on State<T>, WidgetsBindingObserver {
  @mustCallSuper
  @override
  void initState() {
    WidgetsBinding.instance.addObserver(this);
    AppConfigState.themeNotify(context);
    super.initState();
  }

  @mustCallSuper
  @override
  void didChangePlatformBrightness() {
    AppConfigState.themeNotify(context);
    super.didChangePlatformBrightness();
  }

  @mustCallSuper
  @override
  void didChangeAppLifecycleState(AppLifecycleState state) {
    AppConfigState.themeNotify(context);
    super.didChangeAppLifecycleState(state);
  }

  @mustCallSuper
  @override
  void dispose() {
    WidgetsBinding.instance.removeObserver(this);
    super.dispose();
  }
}
""";
